﻿using Inovout.People.Models;
using Inovout.Security;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Inovout.Cloud.Identity.Web.Models
{
    public class SamplesMembershipUserInfo
    {
        //[JsonProperty("user_identifier")]
        public string UserIdentifier { get; set; }

        //[JsonProperty("provider")]
        public string Provider { get; set; }

        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("email")]
        public string Email { get; set; }

        [JsonProperty("mobile")]
        public string Mobile { get; set; }

        public Person Person
        {
            get
            {
                return new Person { Name = Name, Email = Email, Mobile = Mobile };
            }
        }

        public OpenIdUserCredential OpenIdUserCredential
        {
            get
            {
                SystemUser systemUser = new SystemUser();
                systemUser.Name = UserIdentifier;
                return new OpenIdUserCredential
                {
                    Email = Email,
                    AccountName = Name,
                    Provider = Provider,
                    Identifier = UserIdentifier,
                    SystemUser = systemUser
                };
            }
        }

    }
}